//
//  KVariable.m
//  Ghac 4S
//
//  Created by apple on 11-9-1.
//  Copyright (c) 2011年 __MyCompanyName__. All rights reserved.
//

#import "KURLVariable.h"

@implementation KURLVariable
-(id)init
{
    if ((self = [super init]))
    {
        m_variableDic = [[NSMutableDictionary alloc] init];
    }
    return self;
}
-(void)pushParameterKey:(NSString *)param key:(NSString *)key
{
    [m_variableDic setObject:param forKey:key];
}
-(NSString *)variablesString
{
    NSMutableString* str = [[NSMutableString alloc] init];
    NSEnumerator*    enu = [m_variableDic keyEnumerator];
    id key;
    while ((key = [enu nextObject]))
    {
        [str appendFormat:@"%@=%@&", key, [m_variableDic objectForKey:key]];
    }
    if (str.length > 0)
    {
        return [str substringToIndex:str.length - 1];
    }
    return str.description;
}

@end
